import Cookies from "js-cookie";

const TokenKey = "Admin-Token";
const refreshTokenKey = "Admin-refreshToken";

export function getToken() {
  return Cookies.get(TokenKey);
}

export function getTokenTime() {
  const tokenTime = localStorage.getItem("Admin-tokenTime");
  return Number(tokenTime);
}

export function setToken(token) {
  return Cookies.set(TokenKey, token);
}

export function setTokenTime(time) {
  return localStorage.setItem("Admin-tokenTime", time);
}

export function removeToken() {
  return Cookies.remove(TokenKey);
}

export function removeTokenTime() {
  return localStorage.removeItem("Admin-tokenTime");
}

export function getrefreshToken() {
  return Cookies.get(refreshTokenKey);
}

export function getrefreshtokenTime() {
  const refreshtokenTime = localStorage.getItem("Admin-refreshtokenTime");
  return Number(refreshtokenTime);
}

export function setrefreshToken(token) {
  return Cookies.set(refreshTokenKey, token);
}

export function setrefreshTokenTime(time) {
  return localStorage.setItem("Admin-refreshtokenTime", time);
}

export function removerefreshToken() {
  return Cookies.remove(refreshTokenKey);
}

export function removerefreshtokenTime() {
  return localStorage.removeItem("Admin-refreshtokenTime");
}
